In computer science, a virtual machine (VM) is a portion of software that, when executed on appropriate hardware, creates an environment allowing the virtualization of an actual physical computer system. Each VM may function as a self-contained platform, running its own operating system (guest OS) and software applications (guest applications). Typically, a hypervisor, also known as a virtual machine monitor (VMM) or a host OS, manages allocation and virtualization of computer resources and performs context switching, as may be necessary, to cycle between various VMs. A host machine (e.g., computer or server) is typically enabled to simultaneously run multiple VMs, where each VM may be used by a remote client.
A guest application may issue numerous requests to send data over a network to a remote client or other destinations. Each of these requests is associated with significant overhead involving multiple copying of data (e.g., from a guest application memory to a guest operating system buffer and then to a hypervisor buffer). The above excessive data copying and context switching can be reduced using a mechanism known as “zero copy transmission.” For example, one conventional zero copy transmission mechanism may allow a guest application to request transmission of data by issuing a map system call that asks the guest OS for a guest OS buffer. The guest OS reserves the buffer and returns to the guest application, which uses the guest OS buffer to store the data and then issues a system call. The system call invokes the networking stack engine in the guest OS to split the data into packets and attach headers to the data packets. The guest OS then tries to notify the network device driver about the data packets that need to be transmitted over a network. The hypervisor intercepts the request of the guest OS, copies the data packets into the hypervisor buffer, and notifies the guest OS that the data packets have been transmitted. The guest OS driver calls a packet destructor in the guest OS to free the guest OS buffer. The hypervisor then handles the data packets in its buffer.
While the above approach eliminates unnecessary data duplication within the VM, it still requires copying data from the guest OS buffer to the hypervisor buffer. In the host running multiple VMs, with each VM having multiple guest applications that send numerous requests to transmit data over a network, allocating a hypervisor buffer for each request of a guest application and copying data from a guest OS buffer to the hypervisor buffer create significant overhead and increase memory consumption. In addition, in order to perform networking stack processing, the guest OS has to be aware of hardware characteristics of a network device of the host machine, i.e., the guest OS has to be modified each time a network device is upgraded or added to the host machine.
Another existing zero copy transmission mechanism performs networking stack processing in the hypervisor, and not the guest OS, to avoid the necessity for the guest OS to be aware of hardware characteristics of a network device. However, such an approach still requires copying data from the guest OS buffer to the hypervisor buffer. In addition, performing networking stack processing for each data packet of a guest application overloads the hypervisor, negatively affecting its performance.